<template>
  <div class="app-container">
    <el-card>
        <el-form :inline="true" class="demo-form-inline">
        <el-form-item>
          <el-input
            v-model="keyWord"
            placeholder="请输入想要查询的信息"
            @keyup.enter.native.prevent="searchCourseByName"
          ></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" icon="el-icon-search"
          @click="searchCourseByName"
          >搜索</el-button>
        </el-form-item>
      </el-form>

      <!--SC table-->
      <el-table
        v-loading="listLoading"
        :data="list"
        element-loading-text="Loading"
        stripe
        height="550"
        border
        fits
        highlight-current-row
      >
        <el-table-column align="center" label="学号" prop="sId" />
        <el-table-column label="学生名称" prop="sName" />
        <el-table-column label="性别" align="center" prop="sSex" />
        <el-table-column label="年龄" align="center" prop="sAge" />
        <el-table-column label="课程编号" align="center" prop="cId" />
        <el-table-column label="课程名称" align="center" prop="cName" />
        <el-table-column label="学院编号" align="center" prop="deptId" />
        <el-table-column label="学院名" align="center" width="180" prop="deptName" />
        <el-table-column label="学院地址" align="center" prop="address" />
        <el-table-column label="分数" align="center" prop="score" />
      </el-table>
    </el-card>
    
  </div>
</template>

<script>
import { getSelectedCourseInfo } from "@/api/student";
export default {
  data() {
    return {
      list: null,
      listLoading: true,
      keyWord: '',
      dialogAddVisible: false, 
    };
  },
  methods: {
    fetchData() {
      this.listLoading = true;
      getSelectedCourseInfo(this.username).then((response) => {
        this.list = response.data;
        this.listLoading = false;
      });
    },
    //搜索
    searchCourseByName(){
      
    }
  },
  computed:{
    username(){
      return this.$store.getters.name
    } 
  },
  created() {
    this.fetchData();
  },
};
</script>
